package it.polito.connectedcar.network;

public class SimpleNetworkConnectorFactory implements NetworkConnectorFactory {

	private int port;
	private static final int STANDARD_PORT = 9000;
	
	public SimpleNetworkConnectorFactory() {
		String networkPort = System.getProperty("networkPort");
		if(networkPort!=null)
		{
			try
			{
				port = Integer.valueOf(networkPort);
			}catch(NumberFormatException ne)
			{
				port = STANDARD_PORT;
			}
			
		}else
			port = STANDARD_PORT;
	}
	
	@Override
	public synchronized EntityNetworkConnector getConnector() {
		return new SimpleNetworkConnector(port);
	}

}
